<?php

require_once('../utils/query.php');

$userid1 = $_POST["userid1"];
$userid2 = $_POST["userid2"];

$result = execute_query("SELECT tradeid FROM Trade WHERE userid1='%s' AND userid2='%s'", $userid1, $userid2);

$result = mysql_result($result, 0);

$result = execute_query("SELECT possessionid FROM TradePossession WHERE tradeid='%s'", $result);

?>

<table>

<?php

while ($row = mysql_fetch_array($result))
{
	$result2 = execute_query("SELECT cardid FROM Possession WHERE possessionid='%s'", $row[0]);
	$result2 = mysql_result($result2, 0);
	$result2 = execute_query("SELECT name, card_img FROM cards_lu WHERE full_id='%s' AND front=1", $result2);
	?>
	<tr><td><?php echo $result2['name'] ?> </td><td><img src="<?php echo $result2['card_img'] ?>"></img></td><tr>
	<?php
}

?>

</table>
